package com.mitaotao._1_语法._3_分支._1_数值交换;

public class _03_数值交换_中间变量法 {
    public static void main(String[] args) {
        //将num1、num2的数值进行互换
        //中间变量法：利用中间变量a，将两个数进行交换
        int num1 = 2;
        int num2 = 3;
        int temp;
        System.out.println("数值交换之前num1为："+num1);
        System.out.println("数值交换之前num2为："+num2);

        temp = num1;
        num1 = num2;
        num2 = temp;

        System.out.println("数值交换之后num1为："+num1);
        System.out.println("数值交换之后num2为："+num2);

    }
}
